using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblNhomNguoiDungUI
{ 
	private int idNhom;
	public int IdNhom
	{
		get { return idNhom;}
		set { idNhom = value;}
	}

	private String tenNhom;
	public String TenNhom
	{
		get { return tenNhom;}
		set { tenNhom = value;}
	}

	private String moTa;
	public String MoTa
	{
		get { return moTa;}
		set { moTa = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblNhomNguoiDungUI() {}

	public tblNhomNguoiDungUI(int idNhom, String tenNhom, String moTa, bool hoatDong)
	 {
		this.idNhom = idNhom;
 		this.tenNhom = tenNhom;
 		this.moTa = moTa;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenNhom, String moTa, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblNhomNguoiDung_Add",tenNhom,moTa,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idNhom, String tenNhom, String moTa, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblNhomNguoiDung_Update",idNhom,tenNhom,moTa,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idNhom)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblNhomNguoiDung_Delete",idNhom);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblNhomNguoiDung_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idNhom)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblNhomNguoiDung_Get",idNhom);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblNhomNguoiDung_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
